package com.zhx.business.entity;

import com.zhx.business.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;

import javax.persistence.Entity;
import java.math.BigDecimal;

import static org.apache.commons.lang.builder.ToStringStyle.MULTI_LINE_STYLE;

/**
 * 产品表
 */
@Data
@Entity
@ApiModel(value = "产品")
public class Product extends BaseEntity {
    //名称
    private String name;
    //起投金额
    private BigDecimal thresholdAmount;
    //投资步长
    private BigDecimal stepAmount;
    //锁定期
    private Integer lockTerm;
    //收益率 0-100
    private BigDecimal rewardRate;
    //状态 销售中 锁定 已结束
    /**
     * @see com.zhx.business.enums.ProductStatus
     */
    @ApiModelProperty(value = "状态",dataType = "com.zhx.business.enums.ProductStatus")
    private String status;
    //备注
    private String memo;

    public Product(){}

    public Product(String uid, String name, String status, BigDecimal thresholdAmount, BigDecimal stepAmount, BigDecimal rewardRate) {
        this.setUid(uid);
        this.name = name;
        this.status = status;
        this.thresholdAmount = thresholdAmount;
        this.stepAmount = stepAmount;
        this.rewardRate = rewardRate;
    }

    @Override
    public String toString() {
        return ReflectionToStringBuilder.toString(this,MULTI_LINE_STYLE
        );
    }
}
